<?php 
class Menu
{
    var $onglets;
    
    function Menu(){
    	$this->onglets = array();
    	$this->onglets[] = new Onglet("Accueil","index.php");
    	$this->onglets[] = new Onglet("Users");
    	$this->onglets[] = new Onglet("Projets");
    	$this->onglets[] = new Onglet("Articles");
    	$this->onglets[] = new Onglet("Events");
    	$this->onglets[] = new Onglet("Contacts");
    	$this->onglets[] = new Onglet("News");
    	$this->onglets[] = new Onglet("Settings");
    }
    
    function Display(){
    	$menu = "<div id=\"menu\">";
    	$menu .= "<ul id=\"onglets\">";
    	foreach ($this->onglets as $onglet) {
    		$menu .= "<li ";
    		if ($onglet->active){
    			$menu .= "class=\"active\" " ;
    		}
    		$menu .= ">";
    		$menu .= "<a href=\"" . $onglet->link . "\">";
    		$menu .= $onglet->name;
    		$menu .= "</a></li>";
    	}
    	$menu .= "</ul></div>";
    	echo $menu;
    }
}

class Onglet{
	var $name;
	var $link;
	var $active;

	function Onglet($name,$link=False){
		$this->name = $name;
		$this->link = $link;
		if ($this->link == False){
			$this->link = "index.php?page=".$this->name;
		}
		$this->active = False;
		$this->is_active();
	}
	
	function is_active(){
		if ($_SERVER["REQUEST_URI"] == "/labolinux/admin/".$this->link){
			$this->active = true;
		}
	}
}

$menu = new Menu();
$menu->Display();